			 $('.select2').select2();
			 $('.return_icon').click(function(){
			 	console.log(1)
			 	$('input').val('');
			 	$('select').val('');
			 	$('textarea').val('')
			 	parent.$(".close_iframe").animate({left:'100%'});
			 	
			 })
			 $('#upload').change(function(){
					$(this).parent().append('<span class="float-right pic_ha">已选择一张图片</span>')
				})
 			$(".submit").click(function(){
				var sel_M = [];
				var more_Sel = $("select[index='1']");
				
				for (var i = 0;i<more_Sel.length;i++) {
					var now_sel = more_Sel.eq(i).select2("data");
					var Arr = [];
					for (var j = 0;j<now_sel.length;j++) {
						var Text =now_sel[j].text;
						Arr.push(Text);
					}
					sel_M.push(Arr);
					Arr = [];
					 
				}
				
				console.log(sel_M)
				formData = new FormData(document.getElementById("myform"));
				formData.append("credit", $(".sel_credit").select2("val"));//信用
				formData.append("sale-number", $(".sale_num").select2("val"));//月销售笔数
				formData.append("sale-price", $(".sale_price").select2("val"));//客单价
				
	     		formData.append("sale-nature", sel_M[0].join(","));//销售性质
	     		formData.append("sale-way",sel_M[1].join(","));//销售渠道
	     		formData.append("store-kind", sel_M[2].join(","));//店铺类别store_kind
	     		formData.append("sale-kind", sel_M[3].join(","));//售卖类别sale_kind
	     		formData.append("adv-way", sel_M[4].join(","));//宣传渠道
	     		formData.append("receive", sel_M[5].join(","));//接受地
	     		formData.set("file", $("#upload")[0].files[0]);
	     		formData.append("UserId", $.cookie('ID'));
	     	    formData.append("pay-time",$(".sale_time").parent().find(".select2-selection__rendered").text());
		   $.ajax({
					type: "POST",
					url: "http://www.duoweish.com/apis/NewCstm/",
					data: formData,
			
					processData: false,
					contentType: false,
					success: function(data) {
						if(data=='success'){
							parent.layer.msg('新建成功');
						}else{
							parent.layer.msg('新建失败');
						}
							
						
					}
			
				});
             })